
<h2>ข้อมูลคลังความรู้</h2>
<? if(permission($menu_id, 'canadd')!=''){ ?> 
<div id="btnBox" align="right"><a href="<?=$urlpage;?>/form" style="text-decoration:none;"><input type="button" class="ui-state-active ui-corner-all btnAdd" value="เพิ่มรายการ"></a></div>
<? } ?> 
<div id="paging" class="pagination">
<?php echo $pagination;?>
</div>
<form>
				<div id="advancedSearch">
					<table width="95%" border="0" cellspacing="0" cellpadding="0">
					  <tr>
						<td colspan="2"  class="topic_advancedSearch"><img src="images/topic_advancedSearch2.gif" /></td>
					  </tr>
					  <tr>
						<td width="180"><br>ชื่อเรื่อง / ชื่อไฟล์ / เนื้อหา</td>
						<td><br><input type="text" name="titlesearch" value="<?=@$_GET['titlesearch'];?>" class="input_box_advancedSearch1"></td>
					  </tr>
					  <tr>
						<td>Tag / Keyword</td>
						<td><input type="text" name="searchtag" value="<?=@$_GET['searchtag'];?>" class="input_box_advancedSearch1"></td>
					  </tr>
					  <tr>
						<td>ประเภทข้อมูล :<br><br></td>
						<td>
							<table border="0" cellspacing="0" cellpadding="0">
								  <tr>
								  	<? foreach($knowledgetype as $item): 
								  	$selected = $item['id']==@$_GET['title'] ? 'selected="selected"' : ""; ?>
									<td width="135"><input type="checkbox" value="<?=$item['id'] ?>" name="checkbox_search" id="checkbox_search"><label> <?=$item['title'] ?></label></td>
								    <? endforeach;?>
								  </tr>
						  </table>
						</td>
					  </tr>
					  <tr>
						<td>กลุ่มข้อมูล :<br><br></td>
						<td>
							<table border="0" cellspacing="0" cellpadding="0">
								  <tr>
				        	<select name="knowledgegroup">
				        		<option value="">-- ไม่ระบุกลุ่มข้อมูล --</option>
				        		<? foreach($knowledgegroup as $item):
								$selected = $item['id']==@$_GET['title'] ? 'selected="selected"' : "";
								echo '<option value="'.$item['id'].'" '.$selected.'>'.$item['title'].'</option>';
								endforeach;
								?>
				        	</select>
								  </tr>
						  </table>
						</td>
					  </tr>
					  <tr>
						<td>ภาควิชา :<br><br></td>
						<td>
							<?=form_dropdown('section',get_option('id','title','tbsection'),'','','--เลือกหน่วยงาน--');?>
				        
						</td>
					  </tr>
					  <tr>
						<td>พ.ศ ที่ตีพิมพ์ :<br><br></td>
						<td>
							<table width="100%" border="0" cellspacing="0" cellpadding="0">
							  <tr>
								<td width="200">
									
									<select name="Year" value=""> 
										<option value="">------ไม่ระบุ พ.ศ.------</option>
										<option value="2556">2556</option> 
										<option value="2555">2555</option> 
										<option value="2554">2554</option>
										<option value="2553">2553</option>
										<option value="2552">2552</option>  
										<option value="2551">2551</option>
										<option value="2550">2550</option>
									</select>
							</td>
								<td class="td_day" width="200">วันที่พิมพ์ : <input type="text" name="date1"  class="datepicker" size="10" value=""> <img src="images/icon_calendar.gif" /> </td>
								<td class="td_day" width="200">ถึงวันที่ : <input type="text" name="date2" class="datepicker" size="10" value=""> <img src="images/icon_calendar.gif" />	 </td>
							  </tr>
							</table>

						</td>
					  </tr>
					  <tr>
						<td>&nbsp;</td>
						<td><input type="submit" name="submit" value="ค้นหา" ></td>
					  </tr>
					</table>
					</div>
				</form>
<div id="main-content">
	<table class="tbContainer">
		<tr>
			<td align="left">
			<table width="100%" cellspacing="0" cellpadding="10" border="0">
				<tr class="ui-state-error">
			<th class="ui-state-error tdlist">ลำดับ</th>
			<th class="ui-state-error tdlist" align="left">ประเภทข้อมูล</th>
			<th class="ui-state-error tdlist" align="left">เรื่อง</th>
			<th class="ui-state-error tdlist">อ่าน/ดาวโหลด</th>
			<th class="ui-state-error tdlist">วันเผยแพร่</th>
			<th class="ui-state-error tdlist">จัดการข้อมูล</th>
		</tr>
		<?php 
		  $rowStyle = '';
		  $page = (isset($_GET['page']))? $_GET['page']:1;
		  $i=(isset($_GET['page']))? (($_GET['page'] -1)* 10)+1:1;
		  foreach($dataList as $row):
		?>  
		<tr  <? if($rowStyle =='')$rowStyle = 'class="odd"';else $rowStyle = "";echo $rowStyle;?> >
		  <td class="tdlist" width="5%" ><?=$i;?></td>
		  <td class="tdlist" style="cursor: pointer;" align="left" width="15%" onclick="window.location='<?=$urlpage;?>/form/<?=$row['id'];?>'">
				<?
						  		echo @$this->db->getone("SELECT title FROM tbknowledgetype WHERE id=".$row['knowledgetypeid']);
				?>
		  </td>
		  <td class="tdlist" style="cursor: pointer;" align="left"   width="50%" onclick="window.location='<?=$urlpage;?>/form/<?=$row['id'];?>'"><?=$row['title'];?></td>
		  <td class="tdlist" style="cursor: pointer;" align="center" width="10%" onclick="window.location='<?=$urlpage;?>/form/<?=$row['id'];?>'"><?=$row['counter'];?>/
		  	<?
		  	echo @$this->db->getone("SELECT sum(downloads) FROM tbknowledgefiles WHERE pid=".$row['id']);
			
			?>
		  	</td>
		  <td class="tdlist" style="cursor: pointer;" align="center" width="10%" onclick="window.location='<?=$urlpage;?>/form/<?=$row['id'];?>'"><?=DB2Date($row['publishdate'])?></td>		
		  <td class="tdlist" width="10%">
		  	<? if(permission($menu_id, 'candelete')!=''){ ?>
		  	<a href="<?=$urlpage;?>/delete/<?php echo $row['id']?>" style="text-decoration:none;"   onclick="return confirm('<?php echo NOTICE_CONFIRM_DELETE?>')"><input type="button" class="btn_delete" /></a>
		  	<? } ?>  	
		  </td>
		  </tr>		
		<? 
				$i++;
		  		endforeach; 
?>		
			</table>
			</td>
		</tr>
	</table>
</div>
